#checkbutton 可以选择多个  radiobutton只能选一个
import tkinter
# entry 输入文字的条子
window = tkinter.Tk()
window.title = ('窗口名字')
window.geometry("200x200")  # 设置窗口尺寸

l=tkinter.Label(window,text='empyt',bg='yellow',width=20)
l.pack()

def print_selection():
    if (var1.get()==1) & (var2.get()==0):
        l.config(text='选择了python')
    elif (var1.get()==0) & (var2.get()==1):
        l.config(text='选择了C++')
    elif (var1.get()==1) & (var2.get()==1):
        l.config(text='都选了')
    else:
        l.config(text='都没选了')
var1=tkinter.IntVar()
var2=tkinter.IntVar()
c1=tkinter.Checkbutton(window,text='Python',variable=var1,onvalue=1,offvalue=0,command=print_selection)
c2=tkinter.Checkbutton(window,text='C++',variable=var2,onvalue=1,offvalue=0,command=print_selection)
c1.pack()
c2.pack()


window.mainloop()




